
function now() {
    return new Date();
}

function addDays(date, count) {
    var dt = new Date();
    dt = dt.setDate(date.getDate() + count);
    return new Date(dt);
}

function isDateInRange(date, from, to) {
    var in1 = date.getTime()
    var in2 = from.getTime()
    var in3 = to.getTime()

    return (in1>=in2 && in1<=in3)
}

function getDateString(date) {
    var dt = date ? date : new Date();
    return dt.getFullYear() + "/" + _s2(dt.getMonth()) + "/" + _s2(dt.getDate())
}

function getDateTimeString(date) {
    var dt = date ? date : new Date();
    return getDateString(dt) + " "
        + _s2(dt.getHours()) + ":" + _s2(dt.getMinutes()) + ":" + _s2(dt.getSeconds())
}

//...对小于 10 的数补零
function _s2(num) {
    var D=['00','01','02','03','04','05','06','07','08','09']
    if (num<10) {
        return D[num]
    } else {
        return parseInt(num)
    }
}
